package com.javasm.sys.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

@Component
public class AsyncManager {

    private static ThreadPoolTaskExecutor taskExecutor;

    @Autowired
    public  void setTaskExecutor(ThreadPoolTaskExecutor taskExecutor) {
        AsyncManager.taskExecutor = taskExecutor;
    }

    public static void execute(Runnable r){
        taskExecutor.execute(r);
    }
}
